package ink.xiaobaibai.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ink.xiaobaibai.bo.ClientOrderHaveCodeBo;
import ink.xiaobaibai.dao.ClientOrderDao;
import ink.xiaobaibai.entity.ClientOrder;
import ink.xiaobaibai.service.IClientOrderService;
import ink.xiaobaibai.vo.ClientOrderVo;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xiaobaibai
 * @since 2021-05-21
 */
@Service
public class ClientOrderServiceImpl extends ServiceImpl<ClientOrderDao, ClientOrder> implements IClientOrderService {

    @Override
    public List<ClientOrderVo> getClientListByUserId(Integer userId, Integer pageNum, Integer pageSize) {
        int limitStart = (pageNum - 1) * pageSize;
        int limitEnd = pageSize;
        return this.baseMapper.getClientListByUserId(userId, limitStart, limitEnd);
    }

    @Override
    public BigDecimal sumOrderAmount(Integer deviceId) {
        return this.baseMapper.sumOrderAmount(deviceId);
    }

    @Override
    public List<ClientOrder> getOrderListByDeviceId(Integer deviceId, Integer pageNum, Integer pageSize) {
        int limitStart = (pageNum - 1) * pageSize;
        int limitEnd = pageSize;
        return this.baseMapper.getOrderListByDeviceId(deviceId, limitStart, limitEnd);
    }

    @Override
    public List<ClientOrderHaveCodeBo> getOrderBoListByDeviceId(Integer deviceId, Date startTime, Date endTime) {
        return this.baseMapper.getOrderBoListByDeviceId(deviceId, startTime, endTime);
    }

    @Override
    public List<ClientOrderHaveCodeBo> getOrderBoListByAdminUserId(Integer userId, Date startTime, Date endTime) {
        return this.baseMapper.getOrderBoListByAdminUserId(userId, startTime, endTime);
    }

    @Override
    public List<ClientOrderHaveCodeBo> getOrderBoListByDepId(Integer depId, Date startTime, Date endTime) {
        return this.baseMapper.getOrderBoListByDepId(depId, startTime, endTime);
    }

}
